declare global {
  interface Window {
    APP_CONFIG: { API_BASE_PATH: string; };
  }
}

const getRuntimeConfig = () => {
  const defaultConfig = { API_BASE_PATH: '/api' };
  return typeof window !== 'undefined' && window.APP_CONFIG
    ? window.APP_CONFIG : defaultConfig;
};

export const API_CONFIG = {
  get basePath() { return getRuntimeConfig().API_BASE_PATH; },
} as const;
